<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>店铺首页</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../css/aui.css">
    <link rel="stylesheet" href="../../css/common.css">
      <link rel="stylesheet" href="../../css/iconfont/iconfont.css">
    <script type="text/javascript" src="../../script/api.js"></script>
    <script language="JavaScript" src="../../script/vue.js"></script>
    <script language="JavaScript" src="../../script/common.js"></script>
<style>
    .listimg{
        height: 4rem;
    }
    .logo img{
        height: 100%;
    }

     .prd-list-box{

    }
    .prd-list-box .list-title{
        line-height:1.5rem;
        font-size: 0.8rem;
        padding-left: 0.2rem;
    }
    .shopinfo{
        background-color: #fff;
        font-size: 0.7rem;

        position: relative;
        padding: 0.5rem 0.2rem 0.2rem ;
     }
    .shopinfo .baseinfo{
        display: flex;
        justify-content: space-between;
      }
    .shopinfo .logo-title{

    }
    .logo-title .logo{
        width: 3rem;
        height: 3rem;
        display: inline-block;
    }
    .logo-title .title{
        margin-left: 0.2rem;
        vertical-align: top;
        display: inline-block;
    }
    .shop-service{
    position: absolute;
     right: 0.2rem;
        font-size: 0.6rem;
        top:1.2rem;
    }
    .shop-service .shop-btn{
        display: inline-block;
        width: 3rem;
        color:#58595b;
        border-radius: 0.2rem;
        text-align: center;
        line-height: 1rem;
        margin-left: 0.2rem;
        border: 1px solid #ccc;

    }
    .shop-service .shop-btn .fav-color{
        color:#ff0000;
    }
</style>

</head>
<body>
<div id="shopindex">
  <header class="aui-bar aui-bar-nav" id="header">
      <a class="aui-pull-left aui-btn" onclick="closewin();">
          <span class="aui-iconfont aui-icon-left"></span>
      </a>
      <div class="aui-title">店铺首页</div>
  </header>
    <div class="aui-content prd-list-box" >
        <div class="shopinfo">
            <div class="baseinfo">
                <div class="logo-title">
                   <div class="logo">
                       <img  :src="shopinfo.logo_url">
                       </div>
                    <div class="title">
                        <div>{{shopinfo.title}}</div>
                        <div>商品数:{{shopinfo.tproductnum}}</div>
                    </div>
                </div>

                <div class="shop-service">
                    <span class="shop-btn " ><i class="aui-iconfont aui-icon-wechat" style="color:#1ecd16"  ></i>客服</span>
                 <span class="shop-btn "  @click="addfav($event)"  >  <i class="iconfont icon-shoucang1" :class="{'fav-color':favstatus}" ></i> 收藏</span>

                </div>
            </div>
            <div>{{shopinfo.descript}}</div>
        </div>

<div class="list-title">全部商品({{prdlist.totalnum}})</div>

<div class="list-box aui-margin-t-10">
     <div class="row-two-item bgcolor-white" v-for="item in prdlist.list" :key="item.id" @click="gopage(item)" tapmode>
         <div class="goodimg"><img :src="item.cover_pic_url"></div>
         <div class="goodtitle">{{item.title}}  </div>
         <div class="aui-info" >
             <div class="aui-info-item">
               <span class="sale-price aui-margin-l-5" v-if="item.buy_how==0">￥{{item.pin_price/100}}</span>
            <span class="sale-price aui-margin-l-5" v-else>￥{{item.directbuy_price/100}}</span>
              </div>
           <div class="aui-margin-r-10" v-show="item.buy_how==0">已拼{{item.totalsalenum}}件</div>
         </div>

     </div>
 </div>

    </div>

</div>
{include file="public/footer_nav"}
<script>

    var vm = new Vue({
        el:'#shopindex',
        data:{
            shopid:0,
            shopinfo:{},
            prdlist:[],
            favstatus:0,
        },
        methods:{
            addfav:function (e) {
                $page.get_data('/api/member/addHistory', 'post', {data_id: this.shopid,group_flag:'shop', token:$api.getStorage('token')}, function (ret) {
                    var el = e.target;
                      $api.addCls(el,"fav-color");

                    $page.toast(
                         "收藏成功"
                    );

                });
            },
            load_init:function () {
                $page.get_data('/api/shop/getinfo','post',{'id':this.shopid},function (ret) {
                    vm.shopinfo = ret.data;
                });
                $page.get_data('/api/product/getList','post', {'shop_id':this.shopid},function (ret) {
                    vm.prdlist = ret.data;
                });
                $page.get_data('/api/member/getFavStatus','post',{'id':this.shopid,'group_flag':'shop',token:$api.getStorage('token')},function (ret) {
                   vm.favstatus = ret.data.status;
                   console.log(vm.favstatus);
                });
            }
        }
    });
    apiready=function(){
      vm.shopid=api.pageParam.id;
      vm.load_init();
    }

</script>
</body>
</html>
